import React, { memo,useState,useEffect,useLayoutEffect } from 'react';

const index = memo(() => {
    const [count,setCount] = useState(0)
    useEffect(()=>{
        console.log('useEffect');
        return ()=>{
            console.log('useEffect return');
        }
    });

    useLayoutEffect(()=>{ // useLayoutEffect比较快咯 但是会阻塞
     console.log('useLayoutEffect');
     return ()=>{
         console.log('useLayoutEffect return');
     }   
    })
    return (
        <div>
           <h6>  {count}</h6>
            <button
            onClick={e=>{
                setCount(count+1)
            }}
            >
            setCount
            </button>
        </div>
    );
});

export default index;